package com.wctj.api.business.huifu.enums;

/**
 * @author: lzg
 * @description: pending 交易处理中 succeeded 交易成功 failed 交易失败
 */
public enum HuiFuPayStatusEnums {
    pending(0,"交易处理中"),
    succeeded(1,"交易成功"),
    failed(2,"交易失败"),
    unknown(3,"未知")

    ;

    private int code;
    private String msg;

    HuiFuPayStatusEnums(int code ,String message) {
        this.code = code;
        this.msg = message;
    }


    public static HuiFuPayStatusEnums of(int code) {
        for (HuiFuPayStatusEnums apiCode : HuiFuPayStatusEnums.values()) {
            if (apiCode.getCode() == code) {
                return apiCode;
            }
        }
        return HuiFuPayStatusEnums.unknown;
    }

    public static HuiFuPayStatusEnums of(String name) {
        for (HuiFuPayStatusEnums apiCode : HuiFuPayStatusEnums.values()) {
            if (apiCode.name().equals(name)) {
                return apiCode;
            }
        }
        return HuiFuPayStatusEnums.unknown;
    }

    public String getMsg() {
        return msg;
    }

    public int getCode() {
        return code;
    }
}

